package com.Drools.CIPS.controller;

import com.Drools.CIPS.bean.DroolsReturn;
import com.Drools.CIPS.ruler.Xlsx_MXRuler;
import com.Drools.CIPS.util.XmlToMap;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

@RequestMapping("/drools")
@RestController
public class XlsxMXController {
    @Resource
    Xlsx_MXRuler xlsx_mxRuler;

    @RequestMapping("/xlsxMX")//放入  xml文件和xlsx文件进行规则校验
    public DroolsReturn AllDrools(@RequestBody Map<String,Object> map){

        System.out.println("--------------");
        return xlsx_mxRuler.XlsxMXRuler(
                map.get("pathXlsx").toString(),//xlsx物理位置
                XmlToMap.parseXml(map.get("pathXml").toString()/*xml物理位置*/)//xml to Map
        );
    }
}
